

//
//  NTransferViewController.m
//  nncloud
//
//  Created by macfai on 2018/11/22.
//  Copyright © 2018 macfai. All rights reserved.
//

#import "NTransferViewController.h"
#import "NTransferCell.h"
#import "NTransferModel.h"
@interface NTransferViewController ()<UITableViewDelegate,UITableViewDataSource>

@property (nonatomic,strong)UITableView *tableView;

@property (nonatomic,strong)NSMutableArray *dataArray;


@end

@implementation NTransferViewController
#define cellIdentifier @"tran"


-(UITableView *)tableView{
    
    if (!_tableView) {
        
        WeakStament(ws);
        _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0 , 0, ScreenWidth , ScreenHeight - 64) style:UITableViewStylePlain];
        _tableView.delegate = self;
        _tableView.dataSource = self;
        _tableView.rowHeight = 110.0f;
        //        _tableView.separatorColor = [UIColor clearColor];
        _tableView.separatorStyle = 0;
        _tableView.backgroundColor = kBackgroundColor;
        [_tableView registerNib:[UINib nibWithNibName:@"NTransferCell" bundle:nil] forCellReuseIdentifier:cellIdentifier];
        _tableView.showsVerticalScrollIndicator = NO;
        _tableView.tableFooterView = [UIView new];
        
    }
    return _tableView;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = kWhiteColor;
    [self.navigationItem setItemWithTitle:@"流转情况" textColor:kNavigationTitleColor fontSize:18 itemType:center];
    self.dataArray = [NSMutableArray array];
    [self.view addSubview:self.tableView];
    [self loadData];
   
    // Do any additional setup after loading the view from its nib.
}

- (void)loadData{
    
    ///项目申报id
    NSDictionary *dic = @{@"userId":[NGlobalModel shareInstance].shenbaoId?[NGlobalModel shareInstance].shenbaoId:@""};
    [[NNRCNetRequest manager]getWithUrl:kTransferUrl params:dic success:^(id result) {
        
        YYLog(@"%@",result);
            WeakStament(ws);
        if ([[result objectForKey:@"code"] integerValue] == 0) {
            NSArray *arr = result[@"page"][@"records"];
            for (NSDictionary *dic in arr) {
                 NTransferModel *model = [NTransferModel mj_objectWithKeyValues:dic];
                 [ws.dataArray addObject:model];
            }
            [self.tableView reloadData];
        }
    } failure:^(id failure) {
        YYLog(@"%@",failure);
        
    }];
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return self.dataArray.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    
    NTransferCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier forIndexPath:indexPath];

    NTransferModel *model = self.dataArray[indexPath.row];
    cell.model = model;
    if (indexPath.row==4) {
        cell.line.hidden = YES;
    }
    return cell;
}


@end
